ComplaintWindow = function(soiRecord){
    var packingStore = this.packingStore;
    var packingMethodStore = this.packingMethodStore;
	var packingSpecStore = this.packingSpecStore;
    this.soiRecord = soiRecord;
  /*
    var form = new Ext.form.FormPanel({
        frame: true,
        labelWidth: 70,
        id: "soiForm",
        bodyStyle: 'padding: 5px 5px 0',
        defaults: {
            width: 230
        },
        layout: "table",
        layoutConfig: {
            columns: 5
        },
        bodyStyle: "line-height: 26px",
        items: [{
            xtype: "label",
            text: "货物：",
            cls: "formlabel requiredlabel"
        }, {
            colspan: 4,
            layout: "column",
            items: [{
                fieldLabel: "货物",
                xtype: "popupcombo",
                id: "freightName",
                name: "freightName",
                editable: true,
                allowBlank: false,
                store: StoreManager.getCustomerFreightIncreSearchStore(),
                displayField: "fullNameCN",
                valueField: "id",
                queryParam: "keyword",
                triggerAction: "query",
                allowBlank: false,
                forceSelection: true,
                width: 170,
                colspan: 3,
                popupWindow: function(){
                    var customerId = Ext.getCmp("customerId").getValue();
                    var params = {
                        customerId: customerId
                    };
                    var popup = PopupManager.getCustomerFreightPopup(params, function(freight){
                        Ext.getCmp("soiWindow").fillFreightPro(freight);
                    });
                    this.popup = popup;
                },
                listeners: {
                    select: function(combo, record, index){
                        var freightId = record.id;
						var freightCode = record.data?record.data.code:record.code;
                        Ext.getCmp("freightId").setValue(freightId);
						Ext.getCmp("freightCode").setValue(freightCode);
                        this.setValue(record.data ? record.data.fullNameCN : record.name);
                        packingStore.baseParams = {
                            freightId: freightId,
                            setDefaultPacking: true
                        };
                        packingStore.reload();
                        Ext.getCmp("packingId").setValue("");
                        Ext.getCmp("packingId").clearValue("");
                        Ext.getCmp("weight").setValue("");
                        Ext.getCmp("volume").setValue("");
                        Ext.getCmp("fvalue").setValue("");
                    }
                }
            }, {
                xtype: "button",
                id: "tempFreightButton",
                iconCls: "silk-add",
                width: 20,
                listeners: {
                    click: function(){
                        if (Ext.getCmp('package_label').hidden) {
                            //显示临时货物包装录入框
                            Ext.getCmp('soiWindow').showTempFreight();
                            Ext.getCmp('soiWindow').clearForm();
                            Ext.getCmp('freightName').triggerAction = "";
                            Ext.getCmp('freightName').setHideTrigger(true);
                        }
                        else {
                            Ext.getCmp('soiWindow').hideTempFreight();
                        }
                    }
                }
            } ]
        }, {
            xtype: "label",
            id: "package_label",
            text: "包装： ",
            cls: "formlabel",
            hidden: true
        }, {
            xtype: "combo",
            id: "package_modeid",
            editable: false,
            valueField: "id",
            width: 50,
            displayField: "defaultDescription",
            store: packingMethodStore,
            forceSelection: true,
            mode: "remote",
            allowBlank: true,
            triggerAction: "all",
            ctCls: "formfield",
            hidden: true
        }, {
            xtype: "label",
            id: "package_equal",
            text: "=",
            cls: "formlabel",
            hidden: true
        }, {
            xtype: "numberfield",
            id: "package_amount",
            name: "packageamount",
            allowBlank: true,
            width: 50,
            hidden: true
        }, {
            xtype: "combo",
            id: "package_specunit",
            editable: false,
            valueField: "id",
            width: 50,
            displayField: "defaultDescription",
            store: packingSpecStore,
            forceSelection: true,
            allowBlank: true,
            mode: "remote",
            triggerAction: "all",
            ctCls: "formfield",
            hidden: true
        }, {
            xtype: "label",
            id: "package_label_load",
            text: "包装：",
            cls: "formlabel requiredlabel"
        }, {
            xtype: "combo",
            id: "packingId",
            typeAhead: true,
            triggerAction: "all",
            lazyRender: true,
            mode: "local",
            store: packingStore,
            valueField: "id",
            colspan: "4",
            displayField: "packingModeDesc",
            allowBlank: false,
            editable: false,
            listeners: {
                change: function(){
                },
                select: function(){
                    Ext.getCmp("amount").fireEvent("change");
                    if (this.startValue != this.getValue()) {
                        this.fireEvent("change");
                    }
                }
            }
        }, {
            xtype: "label",
            text: "数量：",
            cls: "formlabel requiredlabel"
        }, {
            xtype: "numberfield",
            fieldLabel: "数量",
            id: "amount",
            minValue: 1,
            allowBlank: false,
            allowDecimals: false,
            enableKeyEvents: true,
            colspan: 4,
            allowBlank: false,
            listeners: {
                change: function(){
                    if (Ext.getCmp('package_label_load').isVisible()) {
                        Ext.getCmp("soiWindow").recalculate();
                    }
                },
                keyup: function(field, e){
                    if (Ext.getCmp('package_label_load').isVisible()) {
                        if ((e.getKey() >= 48 && e.getKey() <= 57) ||
                        (e.getKey() >= 96 && e.getKey() <= 105) ||
                        e.getKey() == 8) {
                            this.setValue(this.getRawValue());
                            this.fireEvent("change");
                        }
                    }
                    else {
                    
                    }
                    
                },
                specialkey: function(field, e){
                    if (Ext.getCmp('package_label_load').isVisible()) {
                        if (e.getKey() == e.ENTER) {
                            this.setValue(this.getRawValue());
                        }
                        this.fireEvent("change");
                    }
                    else {
                    
                    }
                    
                }
            }
        }, {
            xtype: "label",
            text: "重量：",
            cls: "formlabel requiredlabel"
        }, {
            xtype: "numberfield",
            fieldLabel: "重量",
            name: "weight",
            id: "weight",
            colspan: 4,
            decimalPrecision: 3,
            minValue: 0,
            allowBlank: false
        }, {
            xtype: "label",
            text: "体积：",
            cls: "formlabel requiredlabel"
        }, {
            xtype: "numberfield",
            fieldLabel: "体积",
            name: "volume",
            id: "volume",
            colspan: 4,
            decimalPrecision: 4,
            minValue: 0,
            allowBlank: false
        }, {
            xtype: "label",
            text: "货值：",
            cls: "formlabel"
        }, {
            xtype: "numberfield",
            fieldLabel: "货值",
            name: "fvalue",
            colspan: 4,
            id: "fvalue",
            decimalPrecision: 2,
            minValue: 0
        }, {
            xtype: "label",
            text: "业务关联方：",
            cls: "formlabel"
        }, {
            xtype: "combo",
            id: "businessAssociated",
            name: "businessAssociated",
            typeAhead: true,
            triggerAction: "all",
            colspan: 4,
            lazyRender: true,
            mode: "local",
            store: bizAssociatedStore,
            valueField: "id",
            displayField: "name",
            editable: false
        }, {
            xtype: "label",
            text: "业务单号：",
            cls: "formlabel"
        }, {
            xtype: "textfield",
            id: "bizNumber",
            name: "bizNumber",
            colspan: 4
        }, {
            xtype: "label",
            text: "备注：",
            cls: "formlabel"
        }, {
            xtype: "textarea",
            fieldLabel: "备注",
            id: "desc",
            name: "desc",
            colspan: 4
        }, {
            xtype: "hidden",
            id: "soiId",
            name: "soiId"
        }, {
            xtype: "hidden",
            id: "freightId",
            name: "freightId"
        }, {
            xtype: "hidden",
            id: "freightCode",
            name: "freightCode"
        }, {
            xtype: "hidden",
            id: "freightValue",
            name: "freightValue"
        }]
    });*/
    ComplaintWindow.superclass.constructor.call(this, {
        id: "complaintWindow",
        title: '关联投诉信息',
        // autoWidth: true,
        width: 350,
        autoHeight: true,
        modal: true,
        closable: true,
        frame: true,
        items: [form],
        buttons: [{
            text: "确定并继续添加",
            scope: this,
            handler: function(){
                if (this.submitSoiForm()) {
                    this.clearForm();
                    this.soiRecord = null;
                }
            }
        }, {
            text: "确定并完成",
            scope: this,
            handler: function(){
                if (this.submitSoiForm()) {
                    this.close();
                }
            }
        }, {
            text: "取消",
            scope: this,
            handler: function(){
                this.close();
            }
        }],
        listeners: {
            afterrender: function(comp){
    	/*
                Ext.select("#soiWindow .requiredlabel").insertHtml("afterend", "<span style='color:red'>*</span>");
                if (Ext.getCmp('soiWindow').soiRecord && Ext.getCmp('soiWindow').soiRecord.data.freightId == "") {
                    this.showTempFreight();
                    Ext.getCmp("tempFreightButton").hide();
                }*/
            }
        }
    });
    
    if (soiRecord) {
        this.fillInForm(soiRecord.data);
        //Ext.getCmp('tempFreightButton').setVisible(false);
    }
}

Ext.extend(ComplaintWindow, Ext.Window, {
   
  
});
